var action = 'funAction';
var vo=[];

function add(){
	showWin('新增',contextPath+'/jframe/cfg/edit/funEdit.jsp?id=0&iframeId_='+iframeId_+'&tabId_='+tabId_,350,300);
}

function edit(){
	var rows = $('#grid').datagrid('getSelections');
	if(rows.length>1){
		alertWarn("请您只选择一条记录进行操作！");
		return;
	}else if(rows.length==0){
		alertError("请您选择要操作的记录！");
		return;
	}
	var id = getSelection();
	showWin('编辑',contextPath+'/jframe/cfg/edit/funEdit.jsp?id='+id+'&iframeId_='+iframeId_+'&tabId_='+tabId_,350,300);
	$('#grid').datagrid('clearSelections');
}

function del(){
	var ids = getSelections();
	if(ids==""){
		alertError("请您选择要操作的记录！");
		return;
	}else{
		econfirm('警告','确定要删除所选择的数据？',function(r){
    		if(r){
    			var url = action+".do?method=delete";
    			$.ajax({
    				url:url,
    		 		type: 'post',
    			    data:{
    			    	ids:ids
    			    },
    			    dataType: 'json',
    			    error: function(){
    			        alertError('删除失败!');
    			    },
    			    success: function(data){
    			    	alertInfo('成功删除所选记录！');
    			    	$('#grid').datagrid('reload');
    			    }
    			});
    		}
    	});
		$('#grid').datagrid('clearSelections');
	}
}

function find(){
	vo=[];
	var name = $('#text').val();
	var iframeId = $('#iframeId').combobox('getValue');
	if(name!=null&&name!='')
		vo.push({name:'name',type:'String',logic:'and',operators:'like',value:name});
	if(iframeId!=null&&iframeId!='')
		vo.push({name:'iframeId',type:'int',logic:'and',operators:'=',value:iframeId});
    $('#grid').datagrid('load',{
        conditions: obj2json(vo)
   });
}



function onLoadSuccess(data){
	
}

function onLoadError(){
	
}

function onDblClickRow(rowIndex, rowData){
	
}

function onBeforeLoad(param){
	
}

function onClickRow(rowIndex,rowData){
	
}

function onBeforeEdit(rowIndex, rowData){
	
}

function onAfterEdit(rowIndex, rowData, changes){
	
}

function onCancelEdit(rowIndex, rowData){
	
}
